package com.app.teaware.bean;


import com.alibaba.fastjson.annotation.JSONField;
import com.app.teaware.basis.Constants;

public abstract class BaseListBeanXF extends BasisBean {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	public static final int INIT_PAGE = 0;
	public static final int PAGE_SIZE = Constants.PAGE_SIZE;
	public static final String PAGE_SIZE_NAME = "pageSize";
	public static final String PAGE_NAME = "pageNum";


	/**
	 * @return the nextPage
	 */
	public int getNextPage() {
		return getCurrent_page()+1;
	}


	public void refresh(){
		setCurrent_page(INIT_PAGE);
	}
	
	public boolean hasNextPage() {
		return getCurrent_page() < getLast_page();
//		return true;
//		return getCurrentPage()*pageSize < totalCounts;
//		return page_info.hasNextPage();
	}


	public void setListBeanData(BaseListBeanXF listbean){
		if(listbean == null)return;
		setTotal(listbean.getTotal());
		setPer_page(listbean.getPer_page());
		setCurrent_page(listbean.getCurrent_page());
		setLast_page(listbean.getLast_page());
	}



	private int total;
	@JSONField(name = "pageSize")
	private int per_page;
	@JSONField(name = "totalPages")
	private int last_page;
	@JSONField(name = "current")
	private int current_page;


	public int getTotal() {
		return total;
	}

	public void setTotal(int total) {
		this.total = total;
	}

	@JSONField(name = "pageSize")
	public int getPer_page() {
		return per_page;
	}

	@JSONField(name = "pageSize")
	public void setPer_page(int per_page) {
		this.per_page = per_page;
	}

	@JSONField(name = "totalPages")
	public int getLast_page() {
		return last_page;
	}

	@JSONField(name = "totalPages")
	public void setLast_page(int last_page) {
		this.last_page = last_page;
	}

	@JSONField(name = "current")
	public int getCurrent_page() {
		return current_page;
	}

	@JSONField(name = "current")
	public void setCurrent_page(int current_page) {
		this.current_page = current_page;
	}

}
